package com.buddy.lock.reentrantlock._09;

import java.util.concurrent.locks.ReentrantLock;

public class GetQueueLengthService {
    public ReentrantLock lock = new ReentrantLock();

    public void serviceMethod(){
        try{
            lock.lock();
            System.out.println("ThreadName= "+Thread.currentThread().getName()+" 进入方法！");
            Thread.sleep(Integer.MAX_VALUE);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }finally {
            lock.unlock();
        }
    }
}
